import upload from '@/utils/upload'
import request from '@/utils/request'

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
	const data = {
		oldPassword,
		newPassword
	}
	return request({
		url: '/system/user/profile/updatePwd',
		method: 'put',
		params: data
	})
}

// 查询用户个人信息
export function getUserProfile() {
	return request({
		url: '/system/user/profile',
		method: 'get'
	})
}

// 修改用户个人信息
export function updateUserProfile(data) {
	return request({
		url: '/system/user/profile',
		method: 'put',
		data: data,
	})
}


// 用户头像上传
export function uploadAvatar(data) {
	return upload({
		url: '/api/upload/image/31',
		name: data.name,
		filePath: data.filePath,
		formData: {
			file: data.filePath
		}
	})
}

// 用户头像上传
export function uploadAvatar2(data) {
	return request({
		url: '/api/upload/image/31',
		method: 'post',
		header: {
			'Content-Type': 'multipart/form-data'
		},
		data: data
	})
}

export function uploadAvatar64(data) {
	return request({
		url: '/api/upload/image64/31',
		method: 'post',
		header: {
			'Content-Type': 'multipart/form-data; boundary=XXX'
		},
		data: data
	})
}
